#include "Point2D.h"


/// <summary>
/// Constructor
/// </summary>
/// <param name="px"> The x-axis value </param>
/// <param name="py"> The y-axis value </param>
CICore::Point2D::Point2D (const int px, const int py) {
    x = px;
    y = py;
}

/// <summary>
/// Destructor
/// </summary>
CICore::Point2D::~Point2D() {}







///<************************************************************************************************************>
///<****************************** region BASIC POINT2D's UNARY OPERATIONS *************************************>
///<************************************************************************************************************>

/// <summary>
/// Postfix increment
/// </summary>
/// <param name="p"> The point to be modified </param>
/// <returns> A reference of the point modified </returns>
CICore::Point2D& CICore::operator ++ (Point2D& p, int) {
    p.x++;
    p.y++;

    return p;
}

/// <summary>
/// Prefix increment
/// </summary>
/// <param name="p"> The point to be modified </param>
/// <returns> A reference of the point modified </returns>
CICore::Point2D& CICore::operator ++ (Point2D& p) {
    ++(p.x);
    ++(p.y);

    return p;
}

/// <summary>
/// Postfix decrement
/// </summary>
/// <param name="p"> The point to be modified </param>
/// <returns> A reference of the point modified </returns>
CICore::Point2D& CICore::operator -- (Point2D& p, int) {
    p.x--;
    p.y--;

    return p;
}

/// <summary>
/// Prefix decrement
/// </summary>
/// <param name="p"> The point to be modified </param>
/// <returns> A reference of the point modified </returns>
CICore::Point2D& CICore::operator -- (Point2D& p) {
    --(p.x);
    --(p.y);

    return p;
}
/***************************************************************************************************************
********************************* endregion BASIC POINT2D's UNARY OPERATIONS ***********************************
****************************************************************************************************************/









///<************************************************************************************************************>
///<****************************** region BASIC POINT2D's BINARY OPERATIONS ************************************>
///<************************************************************************************************************>

/// <summary>
/// Sum between two points
/// </summary>
/// <param name="a"> The first point </param>
/// <param name="b"> The second point </param>
/// <returns> The sum between the two points </returns>
CICore::Point2D CICore::operator + (const Point2D& a, const Point2D& b) {
    return Point2D(a.x+b.x, a.y+b.y);
}

/// <summary>
/// Assignment by addition between two points
/// </summary>
/// <param name="a"> The point to be modified </param>
/// <param name="b"> The point to be added </param>
/// <returns> A reference of the point modified </returns>
CICore::Point2D& CICore::operator += (Point2D& a, const Point2D& b) {
    a.x += b.x;
    a.y += b.y;

    return a;
}

/// <summary>
/// Difference between two points
/// </summary>
/// <param name="a"> The first point </param>
/// <param name="b"> The second point </param>
/// <returns> The difference between the two points </returns>
CICore::Point2D CICore::operator - (const Point2D& a, const Point2D& b) {
    return Point2D(a.x-b.x, a.y-b.y);
}

/// <summary>
/// Assignment by substraction between two points
/// </summary>
/// <param name="a"> The point to be modified </param>
/// <param name="b"> The point to be substracted </param>
/// <returns> A reference of the point modified </returns>
CICore::Point2D& CICore::operator -= (Point2D& a, const Point2D& b) {
    a.x -= b.x;
    a.y -= b.y;

    return a;
}

/// <summary>
/// Product between two points
/// </summary>
/// <param name="a"> The multiplicand point </param>
/// <param name="b"> The multiplier point </param>
/// <returns> The product between the two points </returns>
CICore::Point2D CICore::operator * (const Point2D& a, const Point2D& b) {
    return Point2D(a.x*b.x, a.y*b.y);
}

/// <summary>
/// Assignment by multiplication between two points
/// </summary>
/// <param name="a"> The point to be modified </param>
/// <param name="b"> The multiplier point </param>
/// <returns> A reference of the point modified </returns>
CICore::Point2D& CICore::operator *= (Point2D& a, const Point2D& b) {
    a.x *= b.x;
    a.y *= b.y;

    return a;
}

/// <summary>
/// Quotient between two points
/// </summary>
/// <param name="a"> The dividend point </param>
/// <param name="b"> The divisor point </param>
/// <returns> The quotient between the two points </returns>
CICore::Point2D CICore::operator / (const Point2D& a, const Point2D& b) {
    return Point2D(a.x/b.x, a.y/b.y);
}

/// <summary>
/// Assignment by division between two points
/// </summary>
/// <param name="a"> The point to be modified </param>
/// <param name="b"> The divisor point </param>
/// <returns> A reference of the point modified </returns>
CICore::Point2D& CICore::operator /= (Point2D& a, const Point2D& b) {
    a.x /= b.x;
    a.y /= b.y;

    return a;
}


/// <summary>
/// Sum between a point and a int value
/// </summary>
/// <param name="a"> The point </param>
/// <param name="f"> The int value to be added </param>
/// <returns> The sum between the point and the int value </returns>
CICore::Point2D CICore::operator + (const Point2D& a, const int f) {
    return Point2D(a.x+f, a.y+f);
}

/// <summary>
/// Assignment by addition between a point and a int value
/// </summary>
/// <param name="a"> The point to be modified </param>
/// <param name="b"> The int value to be added </param>
/// <returns> A reference of the point modified </returns>
CICore::Point2D& CICore::operator += (Point2D& a, const int f) {
    a.x += f;
    a.y += f;

    return a;
}

/// <summary>
/// Difference between a point and a int value
/// </summary>
/// <param name="a"> The point </param>
/// <param name="b"> The int value to be substracted </param>
/// <returns> The difference between the point and the int value </returns>
CICore::Point2D CICore::operator - (const Point2D& a, const int f) {
    return Point2D(a.x-f, a.y-f);
}

/// <summary>
/// Assignment by substraction between a point and a int value
/// </summary>
/// <param name="a"> The point to be modified </param>
/// <param name="b"> The int value to be substracted </param>
/// <returns> A reference of the point modified </returns>
CICore::Point2D& CICore::operator -= (Point2D& a, const int f) {
    a.x -= f;
    a.y -= f;

    return a;
}

/// <summary>
/// Product between a point and a int value
/// </summary>
/// <param name="a"> The multiplicand point </param>
/// <param name="b"> The multiplier int value </param>
/// <returns> The product between the and the int value </returns>
CICore::Point2D CICore::operator * (const Point2D& a, const int f) {
    return Point2D(a.x*f, a.y*f);
}

/// <summary>
/// Assignment by multiplication between a point and a int value
/// </summary>
/// <param name="a"> The point to be modified </param>
/// <param name="b"> The multiplier int value </param>
/// <returns> A reference of the point modified </returns>
CICore::Point2D& CICore::operator *= (Point2D& a, const int f) {
    a.x *= f;
    a.y *= f;

    return a;
}

/// <summary>
/// Quotient between a point and a int value
/// </summary>
/// <param name="a"> The dividend point </param>
/// <param name="b"> The divisor int value </param>
/// <returns> The quotient between the and the int value </returns>
CICore::Point2D CICore::operator / (const Point2D& a, const int f) {
    return Point2D(a.x/f, a.y/f);
}

/// <summary>
/// Assignment by division between a point and a int value
/// </summary>
/// <param name="a"> The point to be modified </param>
/// <param name="b"> The divisor int value </param>
/// <returns> A reference of the point modified </returns>
CICore::Point2D& CICore::operator /= (Point2D& a, const int f) {
    a.x /= f;
    a.y /= f;

    return a;
}
/***************************************************************************************************************
********************************* endregion BASIC POINT2D's BINARY OPERATIONS **********************************
****************************************************************************************************************/
